// 主入口程序
// by indraw 2013.01.01
package main

import (
    "app/bbs"
    "utils/web"


)

/**
 * 程序运行初始化
 *
 * author: indraw
 * date: 2012-12-07
 */
func init() {
}


/**
 * 主函数
 *
 * author: indraw
 * date: 2013-01-01
 */
func main() {
    
    //设定静态目录
    
    //路由规则
    web.Get("/", bbs.ForumIndex)                  //首页
    web.Get("/gobbs", bbs.ForumIndex)                  //首页

    web.Get("/forum/([0-9]+)", bbs.ForumList)     //板块
    web.Url("/forum/post", bbs.ThreadPost)     //板块
    web.Url("/forum/reply", bbs.PostReply)     //板块

    web.Url("/user/login", bbs.UserLogin)              //登录页面
    web.Url("/user/logout", bbs.UserLogout)              //
    web.Url("/user/register", bbs.UserRegister)            //注册页面
    web.Get("/user/action", bbs.ActionTop)            //
    web.Get("/user/list", bbs.UserList)            //
    web.Get("/user/favorite", bbs.UserFavorite)            //
    web.Url("/self/info", bbs.UserSelfInfo)            //

    web.Get("/user/([a-z0-9]+)", bbs.UserView)            //
    
    web.Get("/group/list", bbs.GroupUserTop)            //
    web.Get("/group/([0-9]+)", bbs.GroupUserView)     //板块


    web.Get("/t/([A-Za-z0-9]+)", bbs.ThreadRead)     //查看
    web.Get("/pic", bbs.CheckPic)     //查看

    web.Url("/admin", bbs.AdminModer)     //板块

    //运行http服务器
    web.Run("0.0.0.0:" + bbs.CfgPort)
    
    
}
